package com.hongawen;

/**
 * @author hongawen
 * @version 1.0.0
 * @date 2021年09月03日 15:44
 */
public class TestInt {

    public static void main(String[] args) {
        System.out.println(reverse(-223543));
    }

    public static int reverse(int x) {
        StringBuilder stringBuilder = new StringBuilder();
        String chr = "";
        if (x < 0) {
            chr = "-";
            x = Math.abs(x);
            stringBuilder.append(x);
        } else {
            stringBuilder.append(x);
        }
        stringBuilder.reverse();
        String str = stringBuilder.toString();
        return Integer.parseInt(chr + str);
    }
}
